package com.itheima.controller;

import com.itheima.dto.AttentionDto;
import com.itheima.dto.LoginDto;
import com.itheima.vo.Result;
import com.itheima.vo.UserVo;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author :wujunjie
 * createTime :2022-12-27 15:10
 * description :
 */
@RestController
@RequestMapping("/api/v1")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/login/login_auth")
    private Result login(@RequestBody LoginDto loginDto){
     UserVo userVo=userService.login(loginDto);
     if (userVo!=null){
         return Result.success(userVo);
     }
        return Result.error();
    }

    @PostMapping("/user/user_follow")
    private Result attention(@RequestBody AttentionDto attentionDto){
        Boolean attention=userService.attention(attentionDto);
        if (attention){
            return Result.success();
        }
        return Result.error();
    }

}
